﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace BlueLotus7.WeiboApiLibrary.Weibo.Contracts
{
    [DataContract]
    public class WeiboArticle
    {
        [DataContract]
        public enum WeiboContentType
        {
            [EnumMember]
            Weibo = 0x01,
            [EnumMember]
            WeiboComments = 0x02,
            [EnumMember]
            Both = 0x01 | 0x02,
        }

        #region Property

        [DataMember]
        public string ThirdPartyIdentity
        {
            get;
            set;
        }

        [DataMember]
        public int ForwardQuantity
        {
            get;
            set;
        }

        [DataMember]
        public int CommentsQuantity
        {
            get;
            set;
        }

        [DataMember]
        public List<WeiboArticle> Comments
        {
            get;
            set;
        }

        [DataMember]
        public string PostForID
        {
            get;
            set;
        }

        [DataMember]
        public string OriginalID
        {
            get;
            set;
        }

        [DataMember]
        public List<string> PersonIDInvolved
        {
            get;
            set;
        }

        [DataMember]
        public List<WeiboUser> PersonsInvolved
        {
            get;
            set;
        }

        [DataMember]
        public WeiboContentType ContentType
        {
            get;
            set;
        }

        [DataMember]
        public DateTime CreatedStamp
        {
            get;
            set;
        }

        [DataMember]
        public string Agent
        {
            get;
            set;
        }

        [DataMember]
        public WeiboImage Image
        {
            get;
            set;
        }

        [DataMember]
        public string VideoUrl
        {
            get;
            set;
        }

        [DataMember]
        public WeiboLocation Location
        {
            get;
            set;
        }

        [DataMember]
        public string TextContent
        {
            get;
            set;
        }

        #endregion

        public WeiboArticle()
        {
            this.PersonIDInvolved = new List<string>();
            this.PersonsInvolved = new List<WeiboUser>();
        }

        public bool EqualsByID(WeiboArticle article)
        {
            return article != null && !string.IsNullOrWhiteSpace(article.ThirdPartyIdentity) && article.ThirdPartyIdentity == this.ThirdPartyIdentity;
        }
    }
}
